package com.hyb.controller;


import com.alibaba.fastjson.JSON;
import com.hyb.Vo.OrderVo;
import com.hyb.response.Result;
import com.hyb.service.CommodityService;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.jar.JarEntry;

/**
 * <p>
 *  商品Controller
 * </p>
 *
 * @author hyb
 * @since 2021-12-29
 */
@RestController
@RequestMapping("/commodity")
public class CommodityController {

    @Autowired
    private CommodityService commodityService;

    @RequestMapping(value = "/loadCommoditiesByOrderId",method = RequestMethod.GET)
    @ApiModelProperty("根据订单获取商品信息")
    public String loadCommoditiesByOrderId(Integer orderId){
        List<OrderVo> orderVos = commodityService.loadCommoditiesByOrderId(orderId);
        return JSON.toJSONString(new Result().setData(orderVos).setCode(200).setMessage("加载成功"));
    }

}
